﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Krile.Kernel.Control;

namespace Twinkle.Dialogs.Config
{
    public partial class Behavior : ConfigPage
    {
        public Behavior()
        {
            InitializeComponent();
        }

        private void Behavior_Load(object sender, EventArgs e)
        {
            UseSuggest.Checked = Kernel.Config.Behavior.UseSuggest;
            TreatAsReplyToMeIfMentionToMe.Checked = Kernel.Config.Behavior.TreatAsReplyToMeIfMentionToMe;
            DontUseSignatureWhenContainsRT.Checked = Kernel.Config.Behavior.DontUseSignatureWhenContainsRT;
            DontUseSignatureWhenContainsReply.Checked = Kernel.Config.Behavior.DontUseSignatureWhenContainsReply;
            ConfirmAccountsBeforePost.Checked = Kernel.Config.Behavior.ConfirmAccountsBeforePost;
            ConfirmAccountsBeforeFav.Checked = Kernel.Config.Behavior.ConfirmAccountsBeforeFav;
            ConfirmAccountsBeforeRT.Checked = Kernel.Config.Behavior.ConfirmAccountsBeforeRT;
            AutoLookupRTOrigin.Checked = Kernel.Config.Behavior.AutoLookupRTOrigin;
            AddHashtagBeforeRT.Checked = Kernel.Config.Behavior.AddHashtagBeforeRT;
            HashtagOpenInKrile.Checked = Kernel.Config.Behavior.HashtagOpenInKrile;
        }

        public override void Apply()
        {
            Kernel.Config.Behavior.UseSuggest = UseSuggest.Checked;
            Kernel.Config.Behavior.TreatAsReplyToMeIfMentionToMe = TreatAsReplyToMeIfMentionToMe.Checked;
            Kernel.Config.Behavior.DontUseSignatureWhenContainsRT = DontUseSignatureWhenContainsRT.Checked;
            Kernel.Config.Behavior.DontUseSignatureWhenContainsReply = DontUseSignatureWhenContainsReply.Checked;
            Kernel.Config.Behavior.ConfirmAccountsBeforePost = ConfirmAccountsBeforePost.Checked;
            Kernel.Config.Behavior.ConfirmAccountsBeforeFav = ConfirmAccountsBeforeFav.Checked;
            Kernel.Config.Behavior.ConfirmAccountsBeforeRT = ConfirmAccountsBeforeRT.Checked;
            Kernel.Config.Behavior.AutoLookupRTOrigin = AutoLookupRTOrigin.Checked;
            Kernel.Config.Behavior.AddHashtagBeforeRT = AddHashtagBeforeRT.Checked;
            Kernel.Config.Behavior.HashtagOpenInKrile = HashtagOpenInKrile.Checked;
        }

        private void tagAutomaticBindingConfig_Click(object sender, EventArgs e)
        {
            using (var tag = new Hashtag.BindingConfig())
            {
                tag.ShowDialog();
            }
        }
    }
}
